<?php

class Core_Action_Admin_System_Report_Log_Index extends Action_Admin
{
	function execute($request, $initial = false, $script = null)
	{

		if ($initial)
		{
			// check if bread crum is available
			$breadcrums = array(
				array(
					'url' => 'admin/system',
					'label' => 'System'
				),

				array(
					'url' => 'admin/system/report',
					'label' => 'Report'
				),
				array(
					'url' => 'admin/system/report/log',
					'label' => 'Log Browse'
				)
			);

			Agilet::setVar('breadcrum', $breadcrums);
		}

		$table = Model::getTable('core/log');

		$select = $table -> select() -> order('timestamp DESC');

		$items = $table -> fetchAll($select);

		$request -> response = View::render($script = 'core/html/admin/system/report/log/index', $data = array(
			'items' => $items,
			'title' => 'Log Browse'
		));
	}

}
